package com.hurui.xiaoming.activity.launch;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.hurui.xiaoming.R;
import com.hurui.xiaoming.activity.BaseActivity;
import com.hurui.xiaoming.activity.creditor.CreditorActivity;
import com.hurui.xiaoming.activity.finance.FinanceActivity;
import com.hurui.xiaoming.activity.login.LoginActivity;
import com.hurui.xiaoming.activity.main.MainActivity;
import com.hurui.xiaoming.utils.WriteReadSharedPrefs;

public class LaunchActivity extends BaseActivity {

    private TextView goto_next_btn ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launch);
        tintManager.setStatusBarAlpha(0f);
        initView();
        initAction();
    }

    @Override
    public void initView() {
        goto_next_btn = (TextView) findViewById(R.id.goto_next_btn);
    }


    @Override
    public void initAction() {
        goto_next_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Log.i("时间",WriteReadSharedPrefs.readUserLastTime(mContext)+"");
                if(isStop(WriteReadSharedPrefs.readUserLastTime(mContext))){
                    onOpen(new Intent( mContext , LoginActivity.class));
                    finish();
                }else{
                    if("3".equals(WriteReadSharedPrefs.readUserUI_Type(mContext))){
                        onOpen(new Intent( mContext , MainActivity.class));
                        finish();
                    }else if("5".equals(WriteReadSharedPrefs.readUserUI_Type(mContext))){
                        onOpen(new Intent( mContext , CreditorActivity.class));
                        finish();
                    }else if("2".equals(WriteReadSharedPrefs.readUserUI_Type(mContext))){
                        onOpen(new Intent( mContext , FinanceActivity.class));
                        finish();
                    }else {
                        onOpen(new Intent( mContext , LoginActivity.class));
                        finish();
                    }
                }
            }
        });
    }
}
